package domainspecific;

import javax.xml.ws.Endpoint;

/**
 * Simple self-hosted service endpoint.
 */
public class MeterReadingsServiceEndpoint {
	public static void main(String[] args){
		String host="localhost";
		String port="8080";
		
		if(System.getenv().containsKey("READINGS_HOST")){
			host = System.getenv().get("READINGS_HOST");
		}
		if(System.getenv().containsKey("READINGS_PORT")){
			port = System.getenv().get("READINGS_PORT");
		}
		String baseUri="http://" + host + ":" + port + "/";
		
		if(System.getenv().containsKey("BaseUri"))
			baseUri=System.getenv().get("BaseUri");
		
		System.out.println("Starting service ...");
		Endpoint.publish(baseUri + "MeterReadings", new MeterReadingsServiceImpl());		
	}
}
